.class Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;
.super Landroid/view/GestureDetector$SimpleOnGestureListener;
.source "DebugGestureListener.java"

# interfaces
.implements Ljava/lang/Runnable;


# static fields
.field private static final GESTURE_INPUT_TIMEOUT:I = 0x7d0

.field private static final INTERCEPT_INPUT_MASK:I = 0x2

.field private static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final LONG_PRESSED_MASK:I = 0x1

.field private static final SHOWING_DEBUG_INFO:I = 0x4

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private volatile mDebugState:I

.field private final mDebuggableView:Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;

.field private mGestureDetector:Landroid/view/GestureDetector;

.field private final mUiHandler:Landroid/os/Handler;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 42
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->LOG:Lcom/burstly/lib/util/LoggerExt;

    .line 47
    const-class v0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->TAG:Ljava/lang/String;

    return-void
.end method

.method constructor <init>(Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;)V
    .locals 1
    .parameter "debuggableView"

    .prologue
    .line 89
    invoke-direct {p0}, Landroid/view/GestureDetector$SimpleOnGestureListener;-><init>()V

    .line 82
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mUiHandler:Landroid/os/Handler;

    .line 90
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebuggableView:Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;

    .line 91
    return-void
.end method

.method private checkFlag(I)Z
    .locals 1
    .parameter "mask"

    .prologue
    .line 200
    iget v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebugState:I

    and-int/2addr v0, p1

    if-ne v0, p1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method private clearDebugState()V
    .locals 1

    .prologue
    .line 173
    const/4 v0, 0x0

    iput v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebugState:I

    .line 174
    return-void
.end method

.method private clearFlag(I)V
    .locals 2
    .parameter "mask"

    .prologue
    .line 191
    iget v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebugState:I

    xor-int/lit8 v1, p1, -0x1

    and-int/2addr v0, v1

    iput v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebugState:I

    .line 192
    return-void
.end method

.method private setFlag(I)V
    .locals 1
    .parameter "mask"

    .prologue
    .line 182
    iget v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebugState:I

    or-int/2addr v0, p1

    iput v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebugState:I

    .line 183
    return-void
.end method


# virtual methods
.method isDebugModeEnabled()Z
    .locals 1

    .prologue
    .line 166
    const/4 v0, 0x2

    invoke-direct {p0, v0}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->checkFlag(I)Z

    move-result v0

    return v0
.end method

.method public onDown(Landroid/view/MotionEvent;)Z
    .locals 6
    .parameter "e"

    .prologue
    const/4 v0, 0x0

    const/4 v1, 0x1

    .line 137
    invoke-direct {p0, v1}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->checkFlag(I)Z

    move-result v2

    if-eqz v2, :cond_0

    .line 138
    invoke-direct {p0, v1}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->clearFlag(I)V

    .line 139
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mUiHandler:Landroid/os/Handler;

    invoke-virtual {v2, p0}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 140
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mGestureDetector:Landroid/view/GestureDetector;

    invoke-virtual {v2, v1}, Landroid/view/GestureDetector;->setIsLongpressEnabled(Z)V

    .line 141
    sget-object v2, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v3, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->TAG:Ljava/lang/String;

    const-string v4, "Debug session interrupted"

    new-array v5, v0, [Ljava/lang/Object;

    invoke-virtual {v2, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 143
    :cond_0
    const/4 v2, 0x4

    invoke-direct {p0, v2}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->checkFlag(I)Z

    move-result v2

    if-nez v2, :cond_1

    const/4 v2, 0x2

    invoke-direct {p0, v2}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->checkFlag(I)Z

    move-result v2

    if-eqz v2, :cond_2

    :cond_1
    move v0, v1

    :cond_2
    return v0
.end method

.method public onFling(Landroid/view/MotionEvent;Landroid/view/MotionEvent;FF)Z
    .locals 2
    .parameter "e1"
    .parameter "e2"
    .parameter "velocityX"
    .parameter "velocityY"

    .prologue
    const/4 v1, 0x4

    .line 95
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->isDebugModeEnabled()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 96
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mUiHandler:Landroid/os/Handler;

    invoke-virtual {v0, p0}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 97
    invoke-direct {p0}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->clearDebugState()V

    .line 98
    invoke-direct {p0, v1}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->setFlag(I)V

    .line 99
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebuggableView:Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;

    invoke-virtual {v0}, Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;->showDebugView()V

    .line 105
    :cond_0
    :goto_0
    invoke-super {p0, p1, p2, p3, p4}, Landroid/view/GestureDetector$SimpleOnGestureListener;->onFling(Landroid/view/MotionEvent;Landroid/view/MotionEvent;FF)Z

    move-result v0

    return v0

    .line 100
    :cond_1
    invoke-direct {p0, v1}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->checkFlag(I)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 101
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebuggableView:Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;

    invoke-virtual {v0}, Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;->showAdView()V

    .line 102
    invoke-direct {p0}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->clearDebugState()V

    .line 103
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mGestureDetector:Landroid/view/GestureDetector;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/view/GestureDetector;->setIsLongpressEnabled(Z)V

    goto :goto_0
.end method

.method public onLongPress(Landroid/view/MotionEvent;)V
    .locals 5
    .parameter "e"

    .prologue
    const/4 v4, 0x0

    .line 110
    sget-object v0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v1, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->TAG:Ljava/lang/String;

    const-string v2, "Long press captured"

    new-array v3, v4, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 111
    const/4 v0, 0x1

    invoke-direct {p0, v0}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->setFlag(I)V

    .line 112
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mGestureDetector:Landroid/view/GestureDetector;

    invoke-virtual {v0, v4}, Landroid/view/GestureDetector;->setIsLongpressEnabled(Z)V

    .line 113
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mUiHandler:Landroid/os/Handler;

    invoke-virtual {v0, p0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 114
    return-void
.end method

.method public onSingleTapConfirmed(Landroid/view/MotionEvent;)Z
    .locals 4
    .parameter "e"

    .prologue
    const/4 v1, 0x1

    .line 118
    const/4 v2, 0x4

    invoke-direct {p0, v2}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->checkFlag(I)Z

    move-result v2

    if-eqz v2, :cond_0

    .line 119
    new-instance v0, Landroid/app/AlertDialog$Builder;

    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebuggableView:Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;

    invoke-virtual {v2}, Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;->getContext()Landroid/content/Context;

    move-result-object v2

    invoke-direct {v0, v2}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    .line 120
    .local v0, builder:Landroid/app/AlertDialog$Builder;
    const-string v2, "Info"

    invoke-virtual {v0, v2}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

    move-result-object v2

    invoke-virtual {v2, v1}, Landroid/app/AlertDialog$Builder;->setCancelable(Z)Landroid/app/AlertDialog$Builder;

    move-result-object v2

    iget-object v3, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mDebuggableView:Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;

    invoke-virtual {v3}, Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Landroid/app/AlertDialog$Builder;->setMessage(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

    move-result-object v2

    invoke-virtual {v2}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v2

    invoke-virtual {v2}, Landroid/app/AlertDialog;->show()V

    .line 123
    .end local v0           #builder:Landroid/app/AlertDialog$Builder;
    :goto_0
    return v1

    :cond_0
    invoke-super {p0, p1}, Landroid/view/GestureDetector$SimpleOnGestureListener;->onSingleTapConfirmed(Landroid/view/MotionEvent;)Z

    move-result v1

    goto :goto_0
.end method

.method public run()V
    .locals 5

    .prologue
    const/4 v3, 0x0

    const/4 v4, 0x1

    .line 148
    invoke-direct {p0, v4}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->checkFlag(I)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 149
    sget-object v0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v1, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->TAG:Ljava/lang/String;

    const-string v2, "Debug mode enabled, waiting for gesture."

    new-array v3, v3, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 150
    const/4 v0, 0x2

    invoke-direct {p0, v0}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->setFlag(I)V

    .line 151
    invoke-direct {p0, v4}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->clearFlag(I)V

    .line 152
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mUiHandler:Landroid/os/Handler;

    const-wide/16 v1, 0x7d0

    invoke-virtual {v0, p0, v1, v2}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 158
    :goto_0
    return-void

    .line 154
    :cond_0
    sget-object v0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v1, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->TAG:Ljava/lang/String;

    const-string v2, "Debug mode disabled. Time is up."

    new-array v3, v3, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 155
    invoke-direct {p0}, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->clearDebugState()V

    .line 156
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mGestureDetector:Landroid/view/GestureDetector;

    invoke-virtual {v0, v4}, Landroid/view/GestureDetector;->setIsLongpressEnabled(Z)V

    goto :goto_0
.end method

.method setGestureDetector(Landroid/view/GestureDetector;)V
    .locals 0
    .parameter "gestureDetector"

    .prologue
    .line 132
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/DebugGestureListener;->mGestureDetector:Landroid/view/GestureDetector;

    .line 133
    return-void
.end method
